﻿using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Nantianmen.Domain.Repositories;
using Nantianmen.Domain.Services.Destination;

namespace Nantianmen
{
    public class AspNetDestinationService : DestinationService
    {
        private CancellationToken _cancel;

        public AspNetDestinationService(IDestinationStore destinationRepository, IServiceProvider services) : base(destinationRepository)
        {
            _cancel = services.GetRequiredService<IHttpContextAccessor>().HttpContext?.RequestAborted ?? CancellationToken.None;
        }

        protected override CancellationToken CancellationToken => _cancel;

        
    }
}
